1
|
|
|
// Type definitions for wavefile-reader 1.1 |
2
|
|
|
// Project: https://github.com/rochars/wavefile-reader |
3
|
|
|
// Definitions by: Rafael da Silva Rocha <https://github.com/rochars> |
4
|
|
|
// Definitions: https://github.com/rochars/wavefile-reader |
5
|
|
|
|
6
|
|
|
export = wavefileReader; |
7
|
|
|
|
8
|
|
|
declare module wavefileReader { |
9
|
|
|
|
10
|
|
|
class WaveFileReader { |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @param {?Uint8Array=} bytes A wave file buffer. |
14
|
|
|
* @param {boolean=} loadSamples True if the samples should be loaded. |
15
|
|
|
* @throws {Error} If no 'RIFF' chunk is found. |
16
|
|
|
* @throws {Error} If no 'fmt ' chunk is found. |
17
|
|
|
* @throws {Error} If no 'data' chunk is found. |
18
|
|
|
*/ |
19
|
|
|
constructor(bytes?: Uint8Array, loadSamples?:boolean); |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* The container identifier. |
23
|
|
|
* 'RIFF', 'RIFX' and 'RF64' are supported. |
24
|
|
|
* @type {string} |
25
|
|
|
*/ |
26
|
|
|
container: string; |
27
|
|
|
/** |
28
|
|
|
* @type {number} |
29
|
|
|
*/ |
30
|
|
|
chunkSize: number; |
31
|
|
|
/** |
32
|
|
|
* The format. |
33
|
|
|
* Always 'WAVE'. |
34
|
|
|
* @type {string} |
35
|
|
|
*/ |
36
|
|
|
format: string; |
37
|
|
|
/** |
38
|
|
|
* The data of the 'fmt' chunk. |
39
|
|
|
* @type {!Object<string, *>} |
40
|
|
|
*/ |
41
|
|
|
fmt: object; |
42
|
|
|
/** |
43
|
|
|
* The data of the 'fact' chunk. |
44
|
|
|
* @type {!Object<string, *>} |
45
|
|
|
*/ |
46
|
|
|
fact: object; |
47
|
|
|
/** |
48
|
|
|
* The data of the 'cue ' chunk. |
49
|
|
|
* @type {!Object<string, *>} |
50
|
|
|
*/ |
51
|
|
|
cue: object; |
52
|
|
|
/** |
53
|
|
|
* The data of the 'smpl' chunk. |
54
|
|
|
* @type {!Object<string, *>} |
55
|
|
|
*/ |
56
|
|
|
smpl: object; |
57
|
|
|
/** |
58
|
|
|
* The data of the 'bext' chunk. |
59
|
|
|
* @type {!Object<string, *>} |
60
|
|
|
*/ |
61
|
|
|
bext: object; |
62
|
|
|
/** |
63
|
|
|
* The data of the 'ds64' chunk. |
64
|
|
|
* Used only with RF64 files. |
65
|
|
|
* @type {!Object<string, *>} |
66
|
|
|
*/ |
67
|
|
|
ds64: object; |
68
|
|
|
/** |
69
|
|
|
* The data of the 'data' chunk. |
70
|
|
|
* @type {!Object<string, *>} |
71
|
|
|
*/ |
72
|
|
|
data: object; |
73
|
|
|
/** |
74
|
|
|
* The data of the 'LIST' chunks. |
75
|
|
|
* Each item in this list look like this: |
76
|
|
|
* { |
77
|
|
|
* chunkId: '', |
78
|
|
|
* chunkSize: 0, |
79
|
|
|
* format: '', |
80
|
|
|
* subChunks: [] |
81
|
|
|
* } |
82
|
|
|
* @type {!Array<!Object>} |
83
|
|
|
*/ |
84
|
|
|
LIST: object[]; |
85
|
|
|
/** |
86
|
|
|
* The data of the 'junk' chunk. |
87
|
|
|
* @type {!Object<string, *>} |
88
|
|
|
*/ |
89
|
|
|
junk: object; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Set up the WaveFileReader object from a byte buffer. |
93
|
|
|
* @param {!Uint8Array} bytes The buffer. |
94
|
|
|
* @param {boolean=} samples True if the samples should be loaded. |
95
|
|
|
* @throws {Error} If container is not RIFF, RIFX or RF64. |
96
|
|
|
* @throws {Error} If no 'fmt ' chunk is found. |
97
|
|
|
* @throws {Error} If no 'data' chunk is found. |
98
|
|
|
*/ |
99
|
|
|
fromBuffer(bytes: Uint8Array, samples?:boolean): void; |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|